package com.demo2do.fms.admin.entity.export.business;

import java.util.ArrayList;
import java.util.List;

/**
 * 报销单大对象
 *
 * @author Ark
 *
 */
public class ExpenseSheet {

    /** 头部信息 */
    private ExpenseSheetHeader header;
    
    /** 每页派车单信息 */
    private List<ExpenseSheetItem> items;
    
    /** 其他费用明细 */
    private String otherFeeDetail;
    
    /** 尾部汇总信息 */
    private ExpenseSheetFooter footer;
    
    /** 页数信息 */
    private ExpenseSheetPage page;
    
    /**
     * The default constructor
     */
    public ExpenseSheet() {
        
    }
    

    /**
     * 
     * @param header
     * @param items
     * @param otherFeeDetail
     * @param page
     */
    public ExpenseSheet(ExpenseSheetHeader header, List<ExpenseSheetItem> items, String otherFeeDetail,
            ExpenseSheetPage page) {
        this.header = header;
        this.items = items;
        this.otherFeeDetail = otherFeeDetail;
        this.page = page;
    }
    
    /**
     * 
     * @param footer
     * @return
     */
    public ExpenseSheet initialize(ExpenseSheetFooter footer) {
        this.footer = footer;
        return this;
    }
    
    /**
     * 
     * @return
     */
    public boolean isDisplayFooter() {
        return this.page.getCurrents() == this.page.getTotals();
    }
    
    /**
     * 
     * @return
     */
    public int getItemSize() {
        return items.size();
    }
    
    /**
     * 
     * @return
     */
    public List<Integer> getEmptySizes() {
        List<Integer> emptySizes = new ArrayList<Integer>();
        if(page.isEndPage()) {
            for(int i=0; i<(10-this.getItemSize()); i++) {
                emptySizes.add(i);
            }
        } else {
            for(int i=0; i<(14-this.getItemSize()); i++) {
                emptySizes.add(i);
            }
        }
        return emptySizes;
        
    }
    
    /**
     * 
     * @return
     */
    public int getEmptyLength() {
        return this.getEmptySizes().size();
    }

    /**
     * @return the header
     */
    public ExpenseSheetHeader getHeader() {
        return header;
    }

    /**
     * @return the items
     */
    public List<ExpenseSheetItem> getItems() {
        return items;
    }

    /**
     * @return the otherFeeDetail
     */
    public String getOtherFeeDetail() {
        return otherFeeDetail;
    }

    /**
     * @return the footer
     */
    public ExpenseSheetFooter getFooter() {
        return footer;
    }

    /**
     * @return the page
     */
    public ExpenseSheetPage getPage() {
        return page;
    }

    /**
     * @param header the header to set
     */
    public void setHeader(ExpenseSheetHeader header) {
        this.header = header;
    }

    /**
     * @param items the items to set
     */
    public void setItems(List<ExpenseSheetItem> items) {
        this.items = items;
    }

    /**
     * @param otherFeeDetail the otherFeeDetail to set
     */
    public void setOtherFeeDetail(String otherFeeDetail) {
        this.otherFeeDetail = otherFeeDetail;
    }

    /**
     * @param footer the footer to set
     */
    public void setFooter(ExpenseSheetFooter footer) {
        this.footer = footer;
    }

    /**
     * @param page the page to set
     */
    public void setPage(ExpenseSheetPage page) {
        this.page = page;
    }
}
